package com.homwork.Test;

import java.util.Collections;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Test3 {
    //共享数据
    static int a = 0;

    public static void main(String[] ags) throws InterruptedException {
        //创建一个阻塞队列
        BlockingQueue<Runnable> blockingQueue = new LinkedBlockingQueue<>();
        //生产者生产任务,a表示任务数量
        blockingQueue.add(()->{a++;});
        Runnable take = blockingQueue.take();
        take.run();
        System.out.println(a);
//        Collections
    }
}
